package com.sancorseguros.nova.selenium.pageobject;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

import com.sancorseguros.nova.selenium.config.StaticSelenium;

public class NovaMenuPage extends AbstractPage {

	private static final long serialVersionUID = -8607505939368903425L;

	private WebDriver driver;
	
    public NovaMenuPage(WebDriver driver) throws InterruptedException {  
        super();  
        this.setDriver(driver);
        this.setTitle(StaticSelenium.TITLE_NOVA_MENU);
    } 

	public void selectLoss(WebDriver driver) throws InterruptedException {
		driver.findElement(By.xpath("//div[@modulo='Siniestros']")).click();
	}
	
	public LossManagementPage goToLossManagement(WebDriver driver) throws InterruptedException {
		driver.findElement(By.xpath("//a[@href='adminLoss.do']")).click();
		return new LossManagementPage(this.getDriver());
	}
	
	public EnterLossPage goToEnterLoss(WebDriver driver) throws InterruptedException {
		driver.findElement(By.xpath("//a[@href='enterLoss.do']")).click();
		return new EnterLossPage(this.getDriver());
	}
	
	@Override
	public void validatePage() {
		assertTrue(StaticSelenium.INVALID_PAGE, this.verifyPage(this.getDriver(), this.getTitle()));
		
	}
	
	public WebDriver getDriver() {
		return driver;
	}

	public void setDriver(WebDriver driver) {
		this.driver = driver;
	}


}
